package com.lsh.oms.core.enums;

/**
 *
 * @author huangdong
 * @date 16/8/1
 */
public enum OrderStatus {

	/**
	 *
	 */
	ORDER_PRE("预下单", 5),
	ORDER_NEW("新创建", 10),
	ORDER_NO_EDIT("未编辑",12),
	ORDER_SPLIT_CHECK("订单拆单检查",15),
	ORDER_COMMITING_OFC("可提交DC",20),
	ORDER_COMMITED_OFC("已提交OFC",21),
	ORDER_WM_NEW("已提交DC",22),
	ORDER_SORTING("已分拣",31),
	ORDER_DELIVERY("已发货",32),
	ORDER_SIGN("已送达",91),
	ORDER_FINISH("已完成",93),
	ORDER_CANCEL_CUSTOMERSERVICE("客服取消",94),
	ORDER_CANCEL_CUSTOMER("用户取消",95),
	ORDER_CANCEL_SYSTEM("未支付取消",96);

	private final int index;
	private final String name;

	OrderStatus(String name, int index) {
		this.name = name;
		this.index = index;
	}

	public static String getName(int index) {
		for (OrderStatus orderStatus : OrderStatus.values()) {
			if (orderStatus.getIndex() == index) {
				return orderStatus.name;
			}
		}
		return null;
	}

	public static OrderStatus indexOf(int index) {
		for (OrderStatus item : OrderStatus.values()) {
			if (item.getIndex() == index) {
				return item;
			}
		}
		return null;
	}

	public int getIndex() {
		return index;
	}

	public String getName() {
		return name;
	}
}
